<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="favicon.ico" >
<link rel="Shortcut Icon" href="favicon.ico" />
	<div th:replace="common/common :: copy"></div>

<title>修改密码 - 会员管理</title>
</head>
<body>
<article class="cl pd-20">
	<form class="form form-horizontal" id="form-change-password">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>ID：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input readonly th:value="${user.id}" type="text" class="input-text" autocomplete="off" placeholder="" name="id" id="id">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>账户：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input readonly th:value="${user.username}" type="text" class="input-text" autocomplete="off" placeholder="" name="username" id="username">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>新密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="password" class="input-text" autocomplete="off" placeholder="新密码" name="password" id="password">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>确认密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="password" class="input-text" autocomplete="off" placeholder="确认密码" name="password2" id="password2">
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>


<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" th:src="@{/lib/jquery.validation/1.14.0/jquery.validate.js}"></script>
<script type="text/javascript" th:src="@{/lib/jquery.validation/1.14.0/validate-methods.js}"></script>
<script type="text/javascript" th:src="@{/lib/jquery.validation/1.14.0/messages_zh.js}"></script>
<script type="text/javascript" th:inline="javascript">
$(function(){
	var ctxPath = [[@{/}]];
	$("#form-change-password").validate({
		rules:{
			password:{
				required:true,
				minlength:4,
				maxlength:16
			},
			password2:{
				required:true,
				minlength:4,
				maxlength:16,
				equalTo: "#password"
			},
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$(form).ajaxSubmit({
				type: 'post',
				url: ctxPath + "user/userUpdatePassword",
				success: function (data) {
					console.log(data)
					if (data.code == 100) {
						layer.msg('密码修改成功!', {icon: 1, time: 1000});
						setTimeout(function() {
							var index = parent.layer.getFrameIndex(window.name);
							window.parent.location.reload();
							parent.layer.close(index);
						},2000)
					}
					if (data.code == 500) {
						layer.msg('密码修改失败!', {icon: 2, time: 1000});
					}
				},
				error: function (XmlHttpRequest, textStatus, errorThrown) {
					layer.msg('error!', {icon: 1, time: 1000});
				}
			});
		}
	});
});
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>